package ai.people.netmon.framework.domain.gang.construction.vo;

import ai.people.netmon.framework.domain.gang.construction.entity.RelationRule;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 关系库-规则
 * </p>
 *
 * @author zhenglin
 * @since 2022-07-19
 */
@Data
@NoArgsConstructor
public class RelationRuleVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long id;

    /**
     * 规则名
     */
    private String ruleName;

    /**
     * 规则字段
     */
    private List<RelationRule.Rule> rule;

    public RelationRuleVO(RelationRule relationRule) {
        this.id = relationRule.getId();
        this.ruleName = relationRule.getRuleName();
        this.rule = relationRule.buildRule();
    }
}
